Skip to content

Tests: Run slow scanArtifactsForTokens test in CI only by default#3874

Merged
henrymercer merged 2 commits intomainfrom
henrymercer/slow-tests-ci-only
May 7, 2026
Merged

Tests: Run slow scanArtifactsForTokens test in CI only by default#3874
henrymercer merged 2 commits intomainfrom
henrymercer/slow-tests-ci-only

Conversation

@henrymercer
Copy link
Copy Markdown
Contributor

The "scanArtifactsForTokens finds token in debug artifacts" test takes 4.7 seconds to complete on my machine. Run it in CI only by default.

Here's proof that it actually runs.

@henrymercer henrymercer requested a review from a team as a code owner May 6, 2026 17:47
Copilot AI review requested due to automatic review settings May 6, 2026 17:47
@github-actions github-actions Bot added the size/XS Should be very easy to review label May 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the artifact-scanner test suite to avoid running an expensive zip-extraction/token-scan test during typical local runs, while still exercising it in CI to preserve coverage of the regression scenario.

Changes:

  • Adds an environment-gated condition so the slow “scanArtifactsForTokens finds token in debug artifacts” test runs by default only in CI.
  • Introduces a local opt-in mechanism via RUN_SLOW_TESTS=1.
  • Documents the rationale for the gating inline in the test file.
Show a summary per file
File Description
src/artifact-scanner.test.ts Gates the slow artifact-scanning regression test to CI by default with a local opt-in environment variable.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

Copy link
Copy Markdown
Member

@mbg mbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question about why this also changes the test to not run on Windows, given that it would only run in CI.

Aside from that, it makes sense to me to only run this in CI.

// This test is slow (extracts and scans a zip artifact), so by default we only run it in CI. Set
// RUN_SLOW_TESTS=1 to run it locally.
if (
os.platform() !== "win32" &&
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are only running this test in CI, why not also run it on Windows? Given the nature of the function being tested, it seems like we could easily miss a Windows-specific problem.

If there is a good reason why we aren't running it on Windows, it would be good if the comment noted it and explained why.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The artifact scanner isn't compatible with Windows — it's only used in our debug artifact tests, which always run on Linux. It's not compatible because it directly shells out to extract archives.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I had a look at the implementation but didn't see an obvious guard against running on Windows. I saw the isInTestMode() check, but I didn't verify whether we always run on Linux there.

In that case, it might be good to make this more explicit in the main implementation in scanArtifactsForTokens as well and return with a suitable message there if it is somehow running on Windows?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, done!

Comment thread src/artifact-scanner.ts
);
}

if (process.platform === "win32") {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course it is win32 regardless of architecture.

@henrymercer henrymercer enabled auto-merge May 7, 2026 14:50
@henrymercer henrymercer added this pull request to the merge queue May 7, 2026
Merged via the queue into main with commit b81d0d2 May 7, 2026
225 checks passed
@henrymercer henrymercer deleted the henrymercer/slow-tests-ci-only branch May 7, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Should be very easy to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants